package org.example.gc;

/**
 * 相互引用，测试引用计数算法
 * @author youshang
 * @date 2022/03/29 17:42
 **/
public class RefCounter {

    private Object object = null;

    private byte[] bigSize = new byte[5 * 1024 * 1024];//5mb
    public static void main(String[] args) {
        RefCounter refCounter1 = new RefCounter();
        RefCounter refCounter2 = new RefCounter();

        refCounter1.object = refCounter2;
        refCounter2.object = refCounter1;

        System.gc();


    }
}
